<?php

class PdoRecordSet extends RecordSet {
    
    /**
     * @var      PDOStatement
     */
    protected $_stmt;
    protected $_sql;
    
    /**
     * @var      int
     */
    protected $_fetchMode = PDO::FETCH_ASSOC;
    
    public function __construct($stmt, $sql) {
        $this->_stmt = $stmt;
        $this->_sql = $sql;
        $this->_stmt->setFetchMode($this->_fetchMode);
    }
    
    /**
     * @param    int $style    
     * @return   array
     */
    public function fetch($style = null) {
        return $this->_stmt->fetch();
    }
    
    /**
     * @param    int $style    
     * @return   array
     */
    public function fetchAll($style = null) {
        return $this->_stmt->fetchAll();
    }
    
    public function fetchColumn($column_number = null) {
        return $this->_stmt->fetchColumn($column_number);
    }
    
    /**
     * @return   int
     */
    public function rowCount() {
        return $this->_stmt->rowCount();
    }
    
    /**
     * @return   int
     */
    public function columnCount() {
        return $this->_stmt->columnCount();
    }
    
    /**
     * @return   boolean
     */
    public function free() {
        return $this->_stmt->closeCursor();
    }
}

?>